home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 30 / Amiga Format AFCD30 (Sep 1998, Issue 114).iso / -seriously_amiga- / workbench / acknowledge / acknowledge.asc < prev    next >
Text File  |  1998-06-18  |  3KB  |  113 lines

  1. ;acknowledge
  2.  
  3. ;by James L Boyd ("Do-what-you-like-with-it-ware" :)
  4.  
  5. ; uses RIToolTypesLib and RIAPPLib,plus ElmoreLib
  6.  
  7. WBStartup
  8. NoCli
  9.  
  10. .readtooltypes
  11.  
  12. If GetIconObject("PROGDIR:acknowledge")
  13.   message$=FindToolValue("MESSAGE")
  14.   x=Val(FindToolValue("X"))
  15.   y=Val(FindToolValue("Y"))
  16.   If FindToolType("ACKNOWLEDGED") Then status$="Old" Else status$="New" ; set string under icon
  17. FreeIconObject
  18.  
  19.   If message$="" Then message$="Set a message!" ; default message
  20.   If x<0 Then x=0 ; basic error-check ;)
  21.   If y<0 Then y=0 ; same here
  22.  
  23. message$=Replace$(message$,"/","|") ; convert /'s to |'s
  24.  
  25.   ; reason - the request command uses | to make a new line,but
  26.   ; / is easier for the user...I think ;)
  27.  
  28. .appicon
  29.  
  30. If AddAppIcon (0,status$+" message","PROGDIR:acknowledge",x,y)=0
  31.  
  32. ; 0 is the number of the icon - you could have more than one
  33. ; appicon,as long as they have different numbers
  34.  
  35. ; status$ was set above in readtooltypes...
  36.  
  37. ; "PROGDIR:acknowledge" is the location of the icon...you may
  38. ; want to change PROGDIR: to the location on your hard drive,
  39. ; or temporarily assign PROGDIR: to the location...
  40. ; note that you don't add ".info" to the name!
  41.  
  42. ; x and y are the location it will attempt to appear in,as long
  43. ; as no other icons are in the way!
  44.  
  45. Request "Error","AppIcon Failed!|Check icon is named Acknowledge,|and set X and Y in tooltypes to 0!","OK":End
  46.  
  47. ; this ^ happens if the appicon can't be created for some reason
  48. ; maybe low chip mem (very low!) or the icon's not found
  49.  
  50. EndIf
  51.  
  52. .mainloop
  53.  
  54. Repeat
  55.  
  56. VWait 25
  57.  
  58. If Event=$200 Then Goto quit
  59. Until AppEvent
  60.  
  61. If AppEventType=2 AND AppNumFiles=0 Then Goto acknowledge Else Goto mainloop
  62.  
  63. .acknowledge
  64.  
  65. If Request ("Acknowledge",message$,"Acknowledge|Set New Message")=1 Then acknowledged.b=1:Goto quit
  66.  
  67. .setmessage
  68.  
  69. message$=Replace$(message$,"|","/") ; convert \'s to /'s,so they appear like that in the string requester...
  70.  
  71. tmessage$=message$
  72. message$=RTEZGetString ("Acknowledge","Type message here.A slash / starts a new line...",500,message$)
  73. If message$="" Then message$=tmessage$ ; if they click Cancel,
  74.                                        ; you get "" back,hence
  75.                                        ; the temp string tmessage$
  76.  
  77. ; "Acknowledge" is the title
  78. ; "Type message here..." is the "instruction" text
  79. ; 500 is the maximum length of the string
  80. ; message$ is optional - what it puts in by default
  81.  
  82. If message$="" Then message$="Set a message!" ; default text if they choose nothing!
  83. message$=Replace$(message$,"/","|") ; put it back to |'s instead of /'s !
  84.  
  85. If Request ("Acknowledge","Is this OK?||"+message$,"Accept|Edit")=0 Then Goto setmessage ; check if they like it
  86. message$=Replace$(message$,"|","/") ; convert to user-friendly (?!) way before saving...
  87.  
  88. Else Request "Acknowledge","Couldn't find icon!|Make sure the program name is Acknowledge!","OK"
  89. ; ^ this comes from geticonobject line,just under .readtooltypes
  90. EndIf ; from geticonobject line,just under .readtooltypes
  91.  
  92. .quit
  93.  
  94. ; save the tooltypes first :
  95.  
  96. .savetooltypes
  97. If GetIconObject("PROGDIR:acknowledge")
  98.      ClearToolTypes
  99.      NewToolType "DONOTWAIT",""
  100.      NewToolType "MESSAGE",message$
  101.      NewToolType "X",Str$(x)
  102.      NewToolType "Y",Str$(y)
  103.      If acknowledged Then NewToolType "ACKNOWLEDGED",""
  104.      PutIconObject ("PROGDIR:Acknowledge")
  105. FreeIconObject
  106. EndIf ; from geticonobject line,just under .savetooltypes
  107.  
  108. ; that's 'em saved!
  109.  
  110. DelAppIcon(0) ; delete appicon,ID number 0
  111. End ; er,end!
  112.  
  113.